﻿const { Sequelize } = require("sequelize");

const sequelize = new Sequelize("koa_mysql_example_db", "root", "123456", {
  host: "localhost",
  dialect: "mysql",
});

(async () => {
  try {
    await sequelize.authenticate();

    console.log("数据库连接成功");

    await sequelize.sync();
  } catch (err) {
    console.error("数据库连接失败：", err);
  }
})();

module.exports = sequelize;
